package com.dt;

public class xx {
    public static void main(String[] args) {
        A a = new A();
        System.out.println(a.sum(10,20));
        System.out.println(a.sum(1,2,3));//重载的多态
        B b = new B();
        b.say();//重写的多态
        a.say();

    }
}
class B{
    public  void say(){
        System.out.println("B的方法被调用");
    }
}
class A extends B{
    public int sum(int a,int b,int c){
        return a+b+c;
    }
    public int sum(int a,int b){
        return a+b;
    }
    public  void say(){
        System.out.println("A的方法被调用");
    }
}